package com.example.crm.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.crm.entity.Customer;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * 客户Mapper接口
 */
@Mapper
public interface CustomerMapper extends BaseMapper<Customer> {
    
    /**
     * 按分类统计客户数量
     * @return 分类ID与客户数量的映射列表
     */
    @Select("SELECT category_id, COUNT(*) as count FROM crm_customer WHERE deleted = 0 GROUP BY category_id")
    List<Map<String, Object>> countGroupByCategory();
} 